import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class TagView extends StatelessWidget {
  const TagView({
    Key? key,
    required this.titles,
    required this.colors,
  }) : super(key: key);
  final List<String> titles;
  final List<Color> colors;
  @override
  Widget build(BuildContext context) {
    return Wrap(
      spacing: 10.r,
      children: titles
          .asMap()
          .map((key, value) => MapEntry(
              key,
              Container(
                decoration: BoxDecoration(
                  color: colors[key],
                  borderRadius: BorderRadius.circular(2.r),
                ),
                padding: EdgeInsets.symmetric(horizontal: 5.r, vertical: 2.r),
                child: Text(
                  value,
                  style: TextStyle(color: Colors.white, fontSize: 11.sp),
                ),
              )))
          .values
          .toList(),
    );
  }
}
